/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package strategy;

import estrategias.EstrategiaConcretaA;
import estrategias.EstrategiaConcretaB;
import interfaces.Estrategia;
import java.io.IOException;
import javax.swing.JOptionPane;

/**
 *
 * @author Bush
 */
public class Contexto {
    private Estrategia imprime;

    public Contexto() {
        try {
            System.out.print("Escolha o tipo: A | B => ");
            byte b[] = new byte[1];  
            System.in.read(b);  
            String tipo = new String(b);
            if(tipo.equals("A")){
                imprime = new EstrategiaConcretaA();
            }else if(tipo.equals("B")){
                imprime = new EstrategiaConcretaB();
            }
            
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
    }
    
    public void setEstrategia(Estrategia estrategia){
        imprime = estrategia;
    }
    
    public void Imprimir(){
        imprime.escreverTela("Padrão Strategy");
    }
    
    
}
